package com.crm.manager.controller;

import com.crm.common.core.domain.R;
import com.crm.manager.domain.dto.TransferPageDTO;
import com.crm.manager.domain.vo.PageVO;
import com.crm.manager.service.TransferService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@Slf4j
@RequestMapping("/transfer")
public class TransferController {

    @Autowired
    private TransferService transferService;

    @GetMapping("/list")
    public PageVO pageQuery(TransferPageDTO dto){
        return transferService.pageQuery(dto);
    }

    //1：0代表线索，1代表商机 2，原来的归宿人 3，转派给谁
    @PutMapping("/assignment/{type}/{fromUserId}/{toUserId}")
    public R assignment(@PathVariable Integer type, @PathVariable Integer fromUserId, @PathVariable Integer toUserId){
        transferService.assignment(type, fromUserId, toUserId);
        return R.ok(new HashMap<>());
    }

}
